<template>
    <!--案件办理页面——开始-->
    <div class="handling">
        <div class="search-area"  v-show="showSearch">
            <el-form :inline="true" ref="searchForm" :model="searchForm" >
                <el-form-item label="是否转办：" prop="eventStatus">
                    <el-select v-model="searchForm.eventStatus"  size="small" style="width: 240px" @change="getgetEventStatusLv2">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="(item,index) in searchForm.getEventStatusData"
                                :key="index"
                                :label="item.name"
                                :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="案件状态：" prop="eventDealStatus">
                    <el-select v-model="searchForm.eventDealStatus"  size="small" style="width: 240px" :disabled="searchForm.eventStatus===''?true:false">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="(item,index) in searchForm.getEventStatusLv2Data"
                                :key="index"
                                :label="item.name"
                                :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="案件名称：" prop="eventName">
                    <el-input
                            v-model="searchForm.eventName"
                            clearable
                            size="small"
                            style="width: 240px"
                    />
                </el-form-item>
                <!--<el-form-item label="责任主体：" prop="deptParentCode">
                    <el-select v-model="searchForm.deptParentCode" size="small" style="width: 240px;" @change="getDepartment">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.responsibleData"
                                :label="item.name"
                                :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>-->
                <el-form-item label="归属部门：" prop="deptCode">
                    <el-select v-model="searchForm.deptCode" size="small" style="width: 240px;" :disabled="searchForm.deptParentCode===''?true:false" @change="getPrimarylist">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.departmentData"
                                :key="item.value"
                                :label="item.name"
                                :value="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="部门行业：" prop="industryTypeLv1">
                    <el-select v-model="searchForm.industryTypeLv1" size="small" style="width: 240px;" :disabled="searchForm.deptCode===''?true:false" @change="getSecondarylist">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.primaryIndustryData"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="行业类别：" prop="industryTypeLv2">
                    <el-select v-model="searchForm.industryTypeLv2" size="small" style="width: 240px;" :disabled="searchForm.industryTypeLv1===''?true:false">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.secondaryIndustryData"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="所属道路：" prop="roadName">
                    <el-input
                            v-model="searchForm.roadName"
                            clearable
                            size="small"
                            style="width: 240px"
                    />
                </el-form-item>
                <el-form-item label="上报人员：" prop="createrUserName">
                    <el-input
                            v-model="searchForm.eventReportName"
                            clearable
                            size="small"
                            style="width: 240px"
                    />
                </el-form-item>
                <el-form-item label="上报时间：" class="date">
                    <el-col :span="11">
                        <el-date-picker type="date" v-model="searchForm.params.beginTime" value-format="yyyy-MM-dd" placeholder="开始日期" size="small" style="width: 113px"></el-date-picker>
                    </el-col>
                    <el-col class="line" :span="2" style="width: 16px">-</el-col>
                    <el-col :span="11">
                        <el-date-picker type="date" v-model="searchForm.params.endTime" value-format="yyyy-MM-dd" placeholder="结束日期" size="small" style="width: 113px"></el-date-picker>
                    </el-col>
                </el-form-item>
                <el-form-item label="案件类别：" prop="eventType">
                    <el-select v-model="searchForm.eventType"  size="small" style="width: 240px"  @change="getCategory">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.caseTypeData"
                                :label="item.name"
                                :value="item.code" :key="item.code">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="大类：" prop="eventTypeLv1">
                    <el-select v-model="searchForm.eventTypeLv1"  size="small" style="width: 240px" :disabled="searchForm.eventType==='' ? true :false" @change="getSubclass">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.categoryNameData"
                                :label="item.name"
                                :value="item.id"
                                :key="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="小类：" prop="eventTypeLv1">
                    <el-select v-model="searchForm.eventTypeLv2"  size="small" style="width: 240px"  :disabled="searchForm.eventTypeLv1===''? true :false" @change="geteventTypeLv3">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="item in searchForm.subclassNameData"
                                :label="item.name"
                                :key="item.id"
                                :value="item.id">
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="立案条件：" prop="eventTypeLv3">
                    <el-select v-model="searchForm.eventTypeLv3"  size="small" style="width: 240px" :disabled="searchForm.eventTypeLv2===''? true :false">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="(item,index) in searchForm.eventTypeLv3Data"
                                :key="index"
                                :label="item.name"
                                :value="item.id" >
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否督办：" prop="isOversee">
                    <el-select v-model="searchForm.params.isOversee"  size="small" style="width: 240px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="是" value="1"></el-option>
                        <el-option label="否" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否超时：" prop="overTime">
                    <el-select v-model="searchForm.params.overTime"  size="small" style="width: 240px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="是" value="1"></el-option>
                        <el-option label="否" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否回退：" prop="isBack">
                    <el-select v-model="searchForm.params.isBack"  size="small" style="width: 240px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="是" value="1"></el-option>
                        <el-option label="否" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否开放景区：" prop="isOpenScenic">
                    <el-select v-model="searchForm.isOpenScenic"  size="small" style="width: 240px">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="是" value="1"></el-option>
                        <el-option label="否" value="0"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="标段机构：" prop="organizationId">
                    <el-select v-model="searchForm.organizationId"  size="small" style="width: 240px">
                        <el-option label="全部" value=""></el-option>
                        <el-option
                                v-for="(item,index) in organization"
                                :key="index"
                                :label="item.label"
                                :value="item.code" >
                        </el-option>
                    </el-select>
                </el-form-item>
                <el-form-item class="params" prop="isDelay">
                    <el-checkbox v-model="searchForm.params.isDelay">延期</el-checkbox>
                </el-form-item>
                <el-form-item class="params" prop="isSlow">
                    <el-checkbox v-model="searchForm.params.isSlow">缓办</el-checkbox>
                </el-form-item>
                <el-form-item>
                    <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                    <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                    <el-button v-if="createUser.role.roleKey == 'admin' || createUser.role.roleKey == 'ptjxy'"
                               type="warning" size="mini" icon="el-icon-download" @click="exportCasePDF"
                               :disabled="multipleSelection.length === 0">导出</el-button>
                </el-form-item>
            </el-form>
        </div>

        <div class="content-area">
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" style="text-align: right"></right-toolbar>
            <div class="table-list">
                <el-table v-loading="loading" :data="tableList" border height="100%"
                          @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="50" align="center"></el-table-column>
                    <el-table-column label="案件状态" prop="eventDealStatusName"  width="80"/>
                    <el-table-column label="案件名称" prop="eventName" width="190"/>
                    <el-table-column label="发生地址" prop="eventAddress" width="130" show-overflow-tooltip/>
                    <el-table-column label="所属道路" prop="roadName" show-overflow-tooltip/>
                    <el-table-column label="来源" prop="eventSrcTypeName" width="80" show-overflow-tooltip/>
                    <el-table-column label="标段机构" prop="eventThree.organizationName" width="80" show-overflow-tooltip/>
                    <el-table-column label="上报人" prop="eventReportName" width="80" show-overflow-tooltip/>
                    <el-table-column label="所属部门" prop="deptName"/>
                    <el-table-column label="部门行业" prop="industryTypeLv1Name"/>
                    <el-table-column label="行业类别" prop="industryTypeLv2Name"/>
                    <el-table-column label="案件类型" prop="eventTypeName" width="80"/>
                    <el-table-column label="大类" prop="eventTypeLv1Name" show-overflow-tooltip/>
                    <el-table-column label="小类" prop="eventTypeLv2Name" show-overflow-tooltip/>
                    <el-table-column label="立案条件" prop="archivesTypeLeveThree.starConditions" width="100" show-overflow-tooltip/>
                    <el-table-column label="上报时间" prop="createTime" width="170"/>
                    <el-table-column label="超时时间" prop="dealLimitTime" width="170" >
                       <template slot-scope="scope">
                            <div v-if="scope.row.dealLimitTime!=null">
                                <div v-if="scope.row.dealEndTime!=null">
                                    <span v-if="scope.row.dealLimitTime >= scope.row.dealEndTime" class="badge-primary">{{scope.row.dealLimitTime}}</span>
                                    <span v-else class="badge-danger">{{scope.row.dealLimitTime}}</span>
                                </div>
                                <div v-else>
                                    <span v-if="scope.row.dealLimitTime >= nowTime" class="badge-primary">{{scope.row.dealLimitTime}}</span>
                                    <span v-else class="badge-danger">{{scope.row.dealLimitTime}}</span>
                                </div>
                            </div>
                        </template>
                    </el-table-column>
                    <el-table-column label="操作" fixed="right">
                        <template slot-scope="scope">
                            <el-button class="zbbtn" size="mini" type="text" icon="el-icon-user" @click="eventDetails(scope.row)" v-if="scope.row.eventDealStatus === '0101'">转办</el-button>
                            <el-button size="mini" type="text" icon="el-icon-user" @click="eventDetails(scope.row)" v-else-if="scope.row.eventDealStatus === '0206'" style="color: #e6a23c;">结案</el-button>
                            <el-button size="mini" type="text" icon="el-icon-view" @click="eventDetails(scope.row)" v-else>查看</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <div class="pagination">
                <el-pagination v-if="isShowPage"
                               class="no-shadow"
                               @size-change="handleSizeChange"
                               @current-change="handleCurrentChange"
                               :current-page="currentPage"
                               :page-sizes="[15, 25, 50, 100]"
                               :page-size="pageSize"
                               layout="total, sizes, prev, pager, next, jumper"
                               :total="count">
                </el-pagination>
            </div>
        </div>
        <public-dialog :publicDialogVisible="publicDialogVisible" ref="publicDialog" @closeDialog="closeDialog"
                       @getList="getList" :isPolygonClick='isPolygonClick'></public-dialog>
        <!-- 单选弹框 -->
        <el-dialog
            title="请选择导出格式"
            :visible.sync="dialogVisible"
            width="30%"
            :before-close="beforeClose"
            class="radio_dialog">
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="导出格式">
                    <el-radio-group v-model="form.resource">
                        <el-radio label="A4"></el-radio>
                        <el-radio label="A3"></el-radio>
                    </el-radio-group>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="beforeClose">取 消</el-button>
                <el-button type="primary" @click="formatCasePDF">确 定</el-button>
            </span>
        </el-dialog>
    </div>
    <!--案件办理页面——结束-->
</template>

<script>
    import { getCaseHandleData, exportCasePDF,getOrganizationId } from '@/api/case/caseOperate'
    import {eventPend, eventTypelv3, getEventStatus, getEventStatusLv2, saveEventPendEnds} from '@/api/case/caseQuery'
    import {getcaseType, getcategoryName, getsubclassName, getresponsible, getdepartment, getprimaryIndustry, getsecondaryIndustry} from '@/api/configure/configure'
    import PublicDialog from '@/components/PublicDialog'
    export default {
        name:'Casehandling',
        components: {
            PublicDialog
        },
        data(){
            return {
                // 登录的用户信息
                createUser: JSON.parse(localStorage.getItem('userInfo')),
                // 显示搜索条件
                showSearch: true,
                searchForm:{
                    laiyuan:'',
                    eventStatus:'',//是否转办
                    getEventStatusData:[],
                    eventDealStatus:'',//案件状态
                    getEventStatusLv2Data:[],
                    deptParentCode:'',//责任主体
                    responsibleData:[],
                    //归属部门
                    deptCode: '',
                    departmentData: [],
                    //部门行业
                    industryTypeLv1: '',
                    primaryIndustryData: [],
                    //行业类别
                    industryTypeLv2: '',
                    secondaryIndustryData: [],
                    eventName:'',//案件名称
                    createrUserName:'',//上报人
                    roadName:'',//所属道路
                    eventType:'',//案件类别
                    caseTypeData:[],//案件类别数据
                    eventTypeLv1:'',//大类
                    categoryNameData:[],//大类数据
                    eventTypeLv2:'',//小类
                    subclassNameData:[],//小类数据
                    eventTypeLv3:'',//立案条件
                    eventTypeLv3Data:[],//立案条件
                    organizationId:'', //表单机构
                    params:{
                        isDelay:false,//是否延期
                        isSlow:false,//是否缓办
                        beginTime:'',//上报起始时间
                        endTime:'',//上报结束时间
                        isOversee:'',//是否督办
                        overTime:'',//是否超时
                        isBack:'',//是否回退
                        tfjj:'',//安全隐患
                    },
                    isOpenScenic:'',//是否开放景区
                },
                loading:true,//遮罩层
                tableList:[],//表格数据
                // 是否显示分页
                isShowPage: true,
                // 分页页码
                currentPage: 1,
                // 每页数量
                pageSize: 15,
                // 列表数据总数
                count: 0,
                /****** 公共弹出层相关参数 ******/
                // 弹出层显示参数
                publicDialogVisible: false,
                // 弹框地图面数据是否可点击
                isPolygonClick:true,
                // 公共参数
                publicData: {},
                nowTime:'',
                // 列表复选框选择数据
                multipleSelection: [],
                // 保存标段机构
                organization:[],
                // 单选框
                form:{
                    resource:''
                },
                dialogVisible:false
            }
        },
        created() {
            this.getList();
            //获取案件是否转办（大状态）
            this.getEventStatusBig();
            //获取责任主体
            this.getSubject();
            //获取案件类型
            this.getType();
            this.getNowTime();
            this.getOrganizationId()
        },
        methods:{
            /**
             * @description: 通过部门编码查询养护机构
             * @param {*}
             * @return {*}
             */      
            getOrganizationId(){
                getOrganizationId().then((res) => {
                    if(res.code == 200){
                        this.organization = res.data
                    }
                }).catch((error) => {
                    console.log(error, 'getOrganizationId')
                })
            },   
            /**
             * Description:关闭公共弹出层
             * Author:ybt
             * Date:2020/10/28
             */
            closeDialog(){
                this.publicDialogVisible = false;
            },
            /**
             * Description:列表复选框选择按钮
             * Author:ybt
             * Date:2021/2/7
             */
            handleSelectionChange(val) {
                this.multipleSelection = val;
            },
            /**
             * Description:获取当前日期
             * Author:cy
             * Date:2020/10/10
             */
            getNowTime() {
                let now = new Date();
                let year = now.getFullYear(); //得到年份
                let month = now.getMonth(); //得到月份
                let date = now.getDate(); //得到日期
                month = month + 1;
                month = month.toString().padStart(2, "0");
                date = date.toString().padStart(2, "0");
                let defaultDate = `${year}-${month}-${date}`;
                this.searchForm.params.beginTime = defaultDate;
                this.nowTime = defaultDate;
            },
            /**
             * Description:查询列表
             * Author:cy
             * Date:2020/9/17
             */
            getList(){
                this.publicDialogVisible = false;
                this.loading = true;
                let data={
                    pageNum:this.currentPage,
                    pageSize:this.pageSize,
                };
                let obj2 = this.searchForm;
                for(let key in obj2){
                    if(obj2.hasOwnProperty(key) === true) {
                        // 此处hasOwnProperty是判断自有属性，使用 for in 循环遍历对象的属性时，原型链上的所有属性都将被访问会避免原型对象扩展带来的干扰
                        data[key] = obj2[key];
                    }
                }
                getCaseHandleData(data).then(
                    (res) => {
                        this.tableList = res.rows;
                        this.count = res.total;
                        this.loading = false;
                }).catch((error) => {
                    this.loading = false;
                    console.log(error, 'getCaseHandleData')
                })
            },
            /**
             * Description:搜索条件
             * Author:cy
             * Date:2020/9/17
             */
            handleQuery(){
                this.currentPage = 1;
                this.getList();
            },
            /**
             * Description:重置搜索条件
             * Author:cy
             * Date:2020/9/17
             */
            resetQuery(){
                this.resetForm("searchForm");
                let obj3 = this.searchForm;
                for(let key in obj3){
                    if(obj3.hasOwnProperty(key) === true){ //此处hasOwnProperty是判断自有属性
                        obj3[key] = '';
                        if(key === 'params'){
                            obj3['params']={
                                isDelay:false,//是否延期
                                isSlow:false,//是否缓办
                                beginTime:'',//上报起始时间
                                endTime:'',//上报结束时间
                                isOversee:'',//是否督办
                                overTime:'',//是否超时
                                isBack:'',//是否回退
                                tfjj:'',//安全隐患
                            };
                        }
                    }
                }
                //获取案件是否转办（大状态）
                this.getEventStatusBig();
                //获取责任主体
                this.getSubject();
                //获取案件类型
                this.getType();
                // 时间重置
                this.getNowTime();
                this.handleQuery();
            },
            /**
             * Description:案件详情
             * Author:cy
             * Date:2020/9/17
             */
            eventDetails(row){
                this.publicData = {
                    type:3,
                    eventId:row.eventId,
                    eventDealStatus: row.eventDealStatus,
                    eventStatus:row.eventStatus
                }
                // 初始化详情数据
                this.$refs.publicDialog.initPublicData(this.publicData);
                this.publicDialogVisible = true;
            },
            /**
             * Description:切换分页数量
             * Author:cy
             * Date:2020/9/17
             */
            handleSizeChange(size){
                this.pageSize = size;
                this.currentPage = 1;
                this.getList();
            },
            /**
             * Description:切换分页
             * Author:cy
             * Date:2020/9/17
             */
            handleCurrentChange(currentPage){
                this.currentPage = currentPage;
                this.getList();
            },
            /**
             * Description:案件是否转办（大状态）
             * Author:cy
             * Date:2020/9/24
             */
            getEventStatusBig(){
                getEventStatus().then(
                    (res) => {
                        this.searchForm.getEventStatusData = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'getEventStatus');
                })
            },
            /**
             * Description:根据案件是否转办状态获取案件状态
             * Author:cy
             * Date:2020/9/24
             */
            getgetEventStatusLv2(){
                if(this.searchForm.eventStatus === ''){
                    this.searchForm.eventDealStatus = '';
                    return
                }
                this.searchForm.eventDealStatus = '';
                this.searchForm.getEventStatusLv2Data = [];
                getEventStatusLv2({code:this.searchForm.eventStatus}).then(
                    (res) => {
                        this.searchForm.getEventStatusLv2Data = res.data;
                    }
                ).catch((error) => {
                    console.log(error,'getEventStatusLv2');
                })
            },
            //获取责任主体-------默认只有曲江新区
            getSubject(){
                this.loading = true;
                getresponsible().then(
                    (res) => {
                        this.searchForm.deptParentCode = res.data[0].code;
                        this.searchForm.responsibleData = res.data;
                        this.getDepartment();
                        this.loading = false;
                    }
                ).catch((error) => {
                    console.log(error, 'getresponsible');
                });
            },
            //获取归属部门
            getDepartment(){
                if(this.searchForm.deptParentCode === ''){
                    this.searchForm.deptCode='';
                    this.searchForm.industryTypeLv1='';
                    this.searchForm.industryTypeLv2 = '';
                    return;
                }
                this.searchForm.deptCode='';
                this.searchForm.departmentData=[];
                getdepartment({parentId:this.searchForm.deptParentCode}).then(
                    (res) => {
                        this.searchForm.departmentData = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'getdepartment');
                });
            },
            /**
             * Description:获取一级部门
             * Author:cy
             * Date:2020/9/21
             */
            getPrimarylist(){
                if(this.searchForm.deptCode === ''){
                    this.searchForm.industryTypeLv1='';
                    this.searchForm.industryTypeLv2 = '';
                    return;
                }
                this.searchForm.industryTypeLv1='';
                this.searchForm.primaryIndustryData=[];
                getprimaryIndustry(this.searchForm.deptCode).then(
                    (res) => {
                        this.searchForm.primaryIndustryData = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'getprimaryIndustry');
                });
            },
            /**
             * Description:获取二级部门
             * Author:cy
             * Date:2020/9/21
             */
            getSecondarylist(){
                if(this.searchForm.industryTypeLv1 === ''){
                    this.searchForm.industryTypeLv2 = '';
                    return;
                }
                this.searchForm.industryTypeLv2 = '';
                this.searchForm.secondaryIndustryData=[];
                getsecondaryIndustry(this.searchForm.industryTypeLv1).then(
                    (res) => {
                        this.searchForm.secondaryIndustryData = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'getsecondaryIndustry');
                });
            },
            /**
             * Description:获取案件类型
             * Author:ybt
             * Date:2020/9/17
             */
            getType() {
                this.loading = true;
                //获取案件类型
                getcaseType().then(
                    (res) => {
                        this.searchForm.caseTypeData = res.data;
                        this.loading = false;
                    }
                ).catch((error) => {
                    console.log(error, 'getcaseType');
                });
            },
            /**
             * Description:获取大类
             * Author:cy
             * Date:2020/9/21
             */
            getCategory(){
                if(this.searchForm.eventType === ''){
                    this.searchForm.eventTypeLv1 = '';
                    this.searchForm.eventTypeLv2='';
                    this.searchForm.eventTypeLv3='';
                    return;
                }
                this.searchForm.eventTypeLv1 = '';
                this.searchForm.categoryNameData = [];
                //获取案件大类名称
                getcategoryName({type:this.searchForm.eventType}).then(
                    (res) => {
                        this.searchForm.categoryNameData = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'getcategoryName');
                });
            },
            /**
             * Description:获取小类
             * Author:cy
             * Date:2020/9/21
             */
            getSubclass(){
                if(this.searchForm.eventTypeLv1 === ''){
                    this.searchForm.eventTypeLv2='';
                    this.searchForm.deptParentCode='';
                    this.searchForm.eventTypeLv3='';
                    return;
                }
                this.searchForm.eventTypeLv2='';
                this.searchForm.subclassNameData=[];
                getsubclassName({parentId:this.searchForm.eventTypeLv1}).then(
                    (res) => {
                        this.searchForm.subclassNameData = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'getsubclassName');
                });
            },
            /**
             * Description:获取立案条件
             * Author:cy
             * Date:2020/9/23
             */
            geteventTypeLv3(){
                if(this.searchForm.eventTypeLv2 === ''){
                    this.searchForm.eventTypeLv3='';
                    return;
                }
                this.searchForm.eventTypeLv3='';
                this.searchForm.eventTypeLv3Data=[];
                eventTypelv3({parentId: this.searchForm.eventTypeLv2}).then(
                    (res) => {
                        this.searchForm.eventTypeLv3Data = res.data;
                    }
                ).catch((error) => {
                    console.log(error, 'eventTypelv3');
                });
            },
            /**
             * Description:导出案件PDF
             * Author:ybt
             * Date:2021/2/1
             */
            exportCasePDF(){
                if (this.multipleSelection.length > 50) {
                    this.$message.warning('每次最多只能选择50条数据进行导出');
                    return
                } else {
                    this.dialogVisible = true  
                }   
            },
            /**
             * @description: 弹框关闭
             * @param {*}
             * @return {*}
             */            
            beforeClose(){
                this.dialogVisible = false
                this.form.resource = ""
            },
            /**
             * @description: 选择格式导出
             * @param {*}
             * @return {*}
             */     
            formatCasePDF(){
                let eventIds = [];
                if(this.form.resource){
                    let delay = ""
                    if(this.multipleSelection.length <= 5){
                        delay = "2000" 
                    }else if(this.multipleSelection.length > 5 && this.multipleSelection.length <= 15){
                        delay = "4000" 
                    }else if(this.multipleSelection.length > 15 && this.multipleSelection.length <= 35){
                        delay = "6000" 
                    }else{
                        delay = "12000" 
                    }
                    this.loading = true
                    this.multipleSelection.forEach( item => {
                        eventIds.push(item.eventId);
                    })
                    this.dialogVisible = false
                    this.$message({
                        duration:delay,
                        message:this.multipleSelection.length > 15?"正在下载...请稍后（下载数量较多,请耐心等待）":"正在下载...请稍后",
                        type:'success'
                    })          
                    exportCasePDF({eventIds:eventIds,size:this.form.resource,delay:delay}).then((res) => {
                        this.download(res.msg);   
                        this.loading = false;
                        this.form.resource = ""
                    }).catch((error) => {
                        this.loading = false;
                        this.form.resource = ""
                        console.log(error, 'exportCasePDF')
                    })
                }else {
                    this.$message.warning('请选择格式');
                    return false
                } 
            }       
        }
    }
</script>

<style lang="scss">
    .radio_dialog{
        .el-dialog:not(.is-fullscreen) {
            margin-top: 32vh !important;
        }
    }   
    .handling{
        width: 100%;
        height: 100%;
        padding: 0.125rem 0.1875rem;
        display: flex;
        flex-direction: column;
        .search-area{
            display: flex;
            flex-direction: row;
            background-color: #FFFFFF;
            padding: 0.125rem;
            border-radius: 0.075rem;
            margin-bottom: 0.1875rem;
            .el-form--inline{
                .el-form-item{
                    margin-bottom: 0.125rem;
                    margin-right:0.175rem;
                    .el-form-item__label{
                        width: 1.225rem;
                        padding: 0;
                        font-weight: inherit;
                        line-height: 0.4rem;
                    }
                }
            }
            .el-checkbox__inner{
                width:0.25rem;
                height:0.25rem;
            }
            .el-checkbox__inner::after{
                height: 0.1125rem;
                left: 0.0875rem;
                position: absolute;
                top: 0.025rem;
            }
            .el-checkbox__input.is-checked .el-checkbox__inner {
                background-color: #20b2aa;
                border-color: #20b2aa;
            }
            .el-checkbox__inner:hover {
                border-color: #20b2aa;
            }
            .el-checkbox__input.is-checked + .el-checkbox__label {
                color: #606266;
            }
        }
        .content-area{
            display: flex;
            flex-direction: column;
            flex: 1;
            background-color: #FFFFFF;
            padding: 0.125rem;
            border-radius: 0.075rem;
            //margin-top: 15px;
            overflow: hidden;
            .table-list{
                display: flex;
                flex: 1;
                margin: 0.125rem 0;
                overflow: hidden;
                .el-table{
                    flex: 1;
                    overflow-y: auto;
                    .zbbtn{
                        color:#67c23a;
                    }
                }
            }
        }
    }
    .line{text-align: center;}
</style>
<style lang="scss">
    .date{
        .el-input__prefix{
            display:none;
        }
        .el-input--small .el-input__inner{
            padding: 0 0.25rem 0 0.1625rem;
        }
    }
</style>
